<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'saveProduct.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	

 
  
  <script type="text/javascript" src="<%=basePath%>/js/product.js"></script>
  
  <script type="text/javascript">
		function addMore() {
			var input = document.createElement("input");   //创建 <input >
			input.type = "file";   //<input  type="file">
			input.name = "img";   //<input  type="file"  name="img" >
			
			//
			var fileSpan = document.getElementById("fileSpan");
			fileSpan.appendChild(input);  //将构建好的 input 标记 追加到 fileSpan中
			fileSpan.appendChild(document.createElement("br"));
	}
		
	</script>
  
  
 </head>
  
  <body>
  		<jsp:include page="/jsp/head.jsp"></jsp:include>
  	<a href="/WebDemo2/jsp/index.jsp" >返回</a>
  
    	<form action="servlet/ProductServlet?method=saveProduct"  method="post"  enctype="multipart/form-data">
    		
    		<fieldset>
    			<legend>基本信息</legend><!--
                     onblur="checkProductName(this.value)" 
    			--><label>商品名称：</label><input type="text" name="name"   /><span id="result"></span><br>
    			<label>商品价格：</label><input type="text" name="cost"/><br>
    			<label>商品描述：</label><input type="text" name="info"/><br>
    			
    			<label>商品标签：</label>
    				<label><input type="checkbox" name="labelKey"  value="java">java</label>
    				<label><input type="checkbox" name="labelKey"  value="database">database</label>
    				<label><input type="checkbox" name="labelKey"  value="web">web</label>
    				<label><input type="checkbox" name="labelKey"  value="css">css</label>
    				<label><input type="checkbox" name="labelKey"  value="javascript">javascript</label>
    				<label><input type="checkbox" name="labelKey"  value="ssh">ssh</label>
    			
    		</fieldset>
    		
    		<fieldset>
    			<legend>图片信息</legend>
    			<span id="fileSpan">
    				<label>商品图片：</label><br>
    				<input type="file" name="img"    /><br>
    			</span>
    			<br>
    		</fieldset>
    		<input type="submit"  value="添加商品">
    		<input type="button" value="上传更多..." onclick="addMore()">
    	</form>
  </body>
</html>
